import type { Response_Dto } from '@/Dto/Response/Api_Result'
import request from '@/utils/request'

export const Get_UserRights=():Promise<Response_Dto>=>{
    return request({
        url:'api/right/Get_UserRight',
        method:'get'
    })
}

export const GetRightTree=():Promise<Response_Dto>=>{
    return request({
        url:'api/right/GetAllRights',
        method:'get'
    })
}
export const GetFindUserRight=(obj:{id:string}):Promise<Response_Dto>=>{
    return request({
        url:'api/right/GetRightsByUid',
        method:'get',
        params:obj
    })
}
export const updateRight=(obj:{id:string,name:string,icon:string,explain:string,no:Int16Array,url:string,ismenu:Int16Array}):Promise<Response_Dto>=>{

    return request({
        url:'api/right/Update_Right',
        method:'post',
        data:obj
    })
}

export const addright=(obj:{name:string,icon:string,explain:string,no:Int16Array,url:string,ismenu:Int16Array,parentid:string}):Promise<Response_Dto>=>{

    return request({
        url:'api/right/Add_Right',
        method:'post',
        data:obj
    })
}

export const delright=(obj:{id:string}):Promise<Response_Dto>=>{

    return request({
        url:'api/right/Delete_Right',
        method:'post',
        data:obj
    })
}

export const GetAllUserRight=(obj:{page:number,limit:number,key:string}):Promise<Response_Dto>=>{
    return request({
        url:'api/right/GetAllUserRight',
        method:'get',
        params:obj
    })
}

export const GiveUserRight=(obj:{id:string,ids:list<string>}):Promise<Response_Dto>=>{

    return request({
        url:'api/right/Give_Rights',
        method:'post',
        data:obj
    })
}